﻿@using Admin.Models
@using Admin.Models.Chart
@{
    ViewBag.Title = "主页";
}
@(Html.Kendo().Chart<ChartViewModel>()
        .Name("chart")
        .Title("移动平台当月运营图表")
        .Legend(legend => legend
            .Position(ChartLegendPosition.Top)
        )
        .DataSource(ds =>
            ds.Read(read => read.Action("HistoryChartData", "Grid"))
            .Group(group => { group.Add(model => model.LineType); })
            .Sort(sort => { sort.Add(model => model.Day).Ascending(); })
        )
        .Series(series =>
        {
            series.Line(model => model.EnergyValue).Name("#= group.value #  ");
        })
        .CategoryAxis(axis => axis
            .Categories(model => model.Day)
            .Labels(labels => labels.Rotation(-90).Template("#= dataItem.Day # "))
            .Crosshair(c => c.Visible(true))
        )
        .ValueAxis(axis => axis.Numeric()
            .Labels(labels => labels.Format("{0:N2}"))
        )
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Shared(true)
            .Format("{0:C2}")
        )
)
 
    <script>
        $(".sidebar-menu li").removeClass("active");
        $("#home").addClass("active");
    </script>
